using Script.Library.Ability;
using UnityEngine;

public class Round : MonoBehaviour
{
	public new GameObject gameObject;

	public new Transform transform;

	private Creature creature;

	private Shooting.Data data;

	private Vector3 direction;

	private const int lifeTime = 5;

	public void Begin(Creature creature, Shooting.Data data, Vector3 direction)
	{
		this.data = data;
		this.creature = creature;
		this.direction = direction;
		Object.Destroy(gameObject, 5f);
	}

	private void Update()
	{
		transform.position += direction * Time.deltaTime;
	}

	private void OnTriggerEnter2D(Collider2D collision)
	{
		Creature creatureFromMeat = Info.GetCreatureFromMeat(collision);
		if ((bool)creatureFromMeat && !(creature == creatureFromMeat))
		{
			creatureFromMeat.SetHealth(0f - data.damage);
			if (data.poison)
			{
				creatureFromMeat.Poison(4);
			}
			Object.Destroy(gameObject);
		}
	}
}
